class CommentOn extends React.Component {
    async deleteWeibo(id,e){
        e.preventDefault();
        await  this.$axios.delete("/weibo",{
            params:{
                id
            }
        });
        this.props.getWeibo(this.props.pageIndex);
    }
    async upWeibo(id,type,e){
       e.preventDefault();
       // get:/weibo?a=1
            //或
       // get: 将你的参数放置到地址当中。？a=1&b=2
        // await this.$axios.put("/weibo?id="+id+"&type="+type)
       await this.$axios.put("/weibo",{
           id,
           type
       })
        this.props.getWeibo(this.props.pageIndex);
    }
    render() {
        return (
            <div className="commentOn">
                <div className="noContent" style={{
                    display:this.props.contentList.length>0?"none":"block"
                }}>暂无留言</div>
                <div className="messList">
                    {
                        this.props.contentList.map(v=>(
                            <div className="reply" key={v._id}>
                                <p className="replyContent">{v.content}</p>
                                <p className="operation">
                                    <span className="replyTime">{this.$tools.date(v.addTime)}</span>
                                    <span className="handle">
                                    <a href="#" onClick={this.upWeibo.bind(this,v._id,1)} className="top">{v.topNum}</a>
                                    <a href="#" onClick={this.upWeibo.bind(this,v._id,2)} className="down_icon">{v.downNum}</a>
                                    <a href="#" onClick={this.deleteWeibo.bind(this,v._id)} className="cut">删除</a>
                                </span>
                                </p>
                            </div>
                        ))
                    }

                </div>
                {/*<PageList getWeibo={this.props.getWeibo} pageIndex={this.props.pageIndex} pageSum={this.props.pageSum}></PageList>*/}
                <PageList {...this.props}></PageList>
            </div>
        )
    }
}